{include file="admin/header.tpl" title="header" }
<script src="{$baseurl}/javascript/daily_sale.js"></script>

<div id="content">
      {php} echo display_msg(); {/php}
      <h2>Monthly Sales Listing</h2>
      
      <!-- <div class="lstable">
       <form action="{$baseurl}/admin/monthly_expense.php" method="get">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="130" align="left" valign="middle"><strong>Month :</strong></td>
            <td width="227" align="left" valign="middle">
             <select name="month" style="width:100px;">
            	<option value=""> - select - </option> 
                {foreach from=$month_array item=row}
                    <option  {if $post.month eq $row.date} selected="selected" {/if} value="{$row.date}"> {$row.name} </option> 
                {/foreach}
            </select>
            </td>
            <td width="92" align="left" valign="middle"><strong> Store :  </strong></td>
            <td width="242" align="left" valign="middle">
            <select name="store_id" style="width:100px;">
            	<option value=""> - select - </option> 
                {foreach from=$stores item=row}
                    <option {if $post.store_id eq $row.store_id} selected="selected" {/if} value="{$row.store_id}"> {$row.store_name} </option> 
                {/foreach}
            </select>
            </td>
            <td>&nbsp; </td>
             <td>&nbsp; </td>
          </tr>
         
           <tr>
            <td align="left" valign="middle">&nbsp;</td>
            <td align="left" valign="middle">
            	<input type="submit"  class="btncss" name="submit" class="btnSearch" value="Search" /> &nbsp;
                <input class="btncss" type="button" onclick="location.href='{$baseurl}/admin/monthly_expense.php'" value="Reset" />
             </td>
            <td align="left" valign="middle">&nbsp;</td>
            <td align="left" valign="middle">&nbsp;</td>
            <td align="left" valign="middle">&nbsp;</td>
            <td align="left" valign="middle">&nbsp;</td> 
          </tr>
        </table>
        </form>
      </div>-->
       <div><img src="{$admin_imgurl}/spacer.gif" width="1" height="25" alt="spacer" /></div>
      
      <div>
      	{if $session.user_type eq '1'}
      	<div class="admorep" align="right"><a href="{$baseurl}/admin/monthly_expense.php?action=add">Add Monthly Sale</a></div>
        {/if}
        
        <form name="photo_list_form" id="photo_list_form" action="{$baseurl}/admin/monthly_expense.php" method="post">
        	<input type="hidden" name="action" value="update_status"  />
        
        <table cellspacing="0" cellpadding="0" class="engineTable">
          <thead>
            <tr >
              <th width="3%" align="center" valign="top" nowrap="nowrap" > Sr. No</th>
              <th width="8%" nowrap="nowrap" align="left" valign="top">Month</th>
              <th width="20%" nowrap="nowrap" align="left" valign="top">Super Mercado</th>
              <th width="12%" nowrap="nowrap" align="left" valign="top">Created By</th>
              <th  align="right" valign="top">Diario </th>
              <th  align="right" valign="top">Factura Pagado</th>
              {*  <th  align="right" colspan="2" valign="top">Action</th>*}
            </tr>
          </thead>
          <tbody>
        {assign var='counter' value=$pagination_start}
        {assign var='total_bill_paid' value=0}
       	{foreach from=$monthely_expenses item=row}
            {assign var='counter' value=$counter+1}     
            <tr class="{cycle values="even,odd"}">
              <td align="center" valign="middle">{$counter}</td>
              <td align="left" valign="middle" nowrap="nowrap">  {$row.month}</td>
              <td align="left" valign="middle">{$row.store_name}</td>
              <td align="center" valign="middle">{$row.created_on}</td>
              <td align="right" valign="middle">{$row.total_sale}</td>
              <td align="right" valign="middle">{$row.total_bill}</td>
             {* 
               <td align="right" valign="middle">
	               <a id="edit_{$row.monthly_expense_id}" title="Edit" href="{$baseurl}/admin/monthly_expense.php?action=edit&monthly_expense_id={$row.monthly_expense_id}"> <img src="{$admin_imgurl}/edit.png"/> </a> 
               </td>
                <td align="right" valign="middle">
                   <a id="delete_{$row.monthly_expense_id}" title="Delete" href="{$baseurl}/admin/monthly_expense.php?action=delete&monthly_expense_id={$row.monthly_expense_id}" onClick="return confirm('Are You Sure To Delete?')"><img src="{$admin_imgurl}/del.png"  /> </a>
               </td>
              *}
              
            {*
              {if $row.sale_status eq 1 && $session.user_type ne '1'}
              	<td align="center" colspan="3" valign="middle"> <img src="{$admin_imgurl}/lock.png" title="Locked, can not update"/> </td>
              {else}
              
              {if $session.user_type ne '1'}
              <td align="center" valign="middle"> 
                {if $row.sale_status eq 1}	          
	                <img src="{$admin_imgurl}/lock.png" title="Locked, can not update"/>
                {else}
	                <img id="img_confirm_{$row.sale_id}" style="display:none" src="{$admin_imgurl}/lock.png" title="Locked, can not update"/>
    	            <a id="confirm_{$row.sale_id}" onclick="confirmStatus({$row.sale_id})" title="Confirm" href="javascript:void(0)"> <img src="{$admin_imgurl}/active.png"/> </a>
                {/if}
              </td>  
              {/if}
              
              	<td align="center" valign="middle">
              {if $row.sale_status eq 1 && $session.user_type ne '1'}
              	<img src="{$admin_imgurl}/lock.png" title="Locked, can not update"/>
              {else} 
      	        <img id="img_edit_{$row.sale_id}" style="display:none" src="{$admin_imgurl}/lock.png" title="Locked, can not update"/>
              	<a id="edit_{$row.sale_id}" title="Edit" href="{$baseurl}/admin/daily_sale.php?action=edit&sale_id={$row.sale_id}"> <img src="{$admin_imgurl}/edit.png"/> </a> 
              {/if}
               </td>
              <td align="center" valign="middle">
              {if $row.sale_status eq 1 && $session.user_type ne '1'}
              	<img src="{$admin_imgurl}/lock.png" title="Locked, can not update"/>
              {else} 
              	<img id="img_delete_{$row.sale_id}" style="display:none" src="{$admin_imgurl}/lock.png" title="Locked, can not update"/>
              	<a id="delete_{$row.sale_id}" title="Delete" href="{$baseurl}/admin/daily_sale.php?action=delete&sale_id={$row.sale_id}" onClick="return confirm('Are You Sure To Delete?')"><img src="{$admin_imgurl}/del.png"  /> </a>
              {/if}
              	
               </td>

              
              {/if}
              
              *}
              
                          </tr>
        {foreachelse}
        	
            
           <tr><td colspan="11" align="center"> No Record Found </td></tr>
        {/foreach}
        {if $sales|@count gt 0}
        <tr><td colspan="5" align="lefft"> <strong>Total(s) : </strong> </td> <td align="right"> <strong>{$total_sale}</strong> </td> <td>&nbsp;  </td> <td align="right"> <strong>{$total_bill_paid}</strong> <td colspan="4"> </td> </tr>
        {/if}
            
          </tbody>
        </table>
        </form>
        <div class="pagination tn"> 
        	<div class="page_limit_div">
        		 {$page_limit_select}
	        </div>
        {$pagination}
          <div class="totalno"><strong>Total Records:</strong> {$total_records}</div>
          <div class="clear"></div>
        </div>
      </div>
    </div>
    {literal}
    <script> $('#sale_date').datepicker({rangeSelect: true, onClose: function() { /*checkDaysBetweenMatch(); checkMatchExist()*/ }}); 	 </script>
	{/literal}    
     {include file="admin/footer.tpl" title="footer"}   